package com.linkhub.oms.admin.modules.order.service;

import com.linkhub.oms.admin.modules.order.domain.param.OrderBizStatusChangeParam;
import com.linkhub.oms.admin.modules.order.domain.param.OrderLogisticParam;
import com.linkhub.oms.admin.modules.order.domain.vo.LogisticFreightVO;
import com.linkhub.oms.admin.modules.order.domain.vo.OrderLogisticVO;
import com.linkhub.oms.entity.OrderEntity;
import com.linkhub.oms.entity.PickUpGoodsOrderEntity;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * @Description: OrderBizService
 * @Author: echo
 * @Date: 2024/4/3 15:32
 * @Version: 1.0
 */
public interface OrderBizService {

    /**
     * 变更订单业务状态
     *
     * @param bizStatusChangeParam bizStatusChangeParam
     */
    void changeBizState(OrderBizStatusChangeParam bizStatusChangeParam);


    /**
     * 保存订单信息，包括子表
     *
     * @param orders orders
     */
    void saveBatchOrders(List<OrderEntity> orders);


    /**
     * 物理删除订单相关信息
     *
     * @param orderIds orderIds
     */
    void deleteOrders(List<String> orderIds);

    /**
     * 保存提货单
     *
     * @param pickUpGoodsOrder pickUpGoodsOrder
     */
    void saveEntryOrders(PickUpGoodsOrderEntity pickUpGoodsOrder);


    /**
     * 编辑提货单
     *
     * @param pickUpGoodsOrder pickUpGoodsOrder
     */
    void updateEntryOrders(PickUpGoodsOrderEntity pickUpGoodsOrder);


    /**
     * 查询订单可选的物流渠道
     *
     * @param sysOrderId sysOrderId
     * @return 物流
     */
    List<OrderLogisticVO> listOrderLogistics(String sysOrderId);

    /**
     * 查询物流预估运费
     *
     * @param sysOrderId  sysOrderId
     * @param channelCode channelCode
     * @return
     */
    LogisticFreightVO queryLogisticFreight(String sysOrderId, String channelCode);

    /**
     * 根据包裹重量体积，查询运费
     * @param sysOrderId
     * @param packageWeight 包裹重(g)
     * @param packageVolume 包裹体积(cm^3)
     * @return
     */
    LogisticFreightVO queryLogisticFreightByPackage(String sysOrderId, BigDecimal packageWeight, BigDecimal packageVolume);

    /**
     * updateOrderLogistic
     *
     * @param logisticParam logisticParam
     */
    void updateOrderLogistic(OrderLogisticParam logisticParam);


    /**
     * resetOrderLogistic
     *
     * @param sysOrderId sysOrderId
     */
    void resetOrderLogistic(String sysOrderId);

    /**
     * resetOrderLogistics
     *
     * @param sysOrderIds sysOrderIds
     */
    void resetOrderLogistics(List<String> sysOrderIds);


    /**
     * autoMatchOrderLogistic
     *
     * @param sysOrderId sysOrderId
     */
    void autoMatchOrderLogistic(String sysOrderId);

    Void interceptLogistics( String sysOrderId );

    boolean syncOrderIfNecessary(List<OrderEntity> pendingSubmitOrders);
}
